﻿
Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim FilterReplaceValues As New Specialized.NameValueCollection
        FilterReplaceValues.Add("(sample text)", "<H2>$1</H2>")
        FilterReplaceValues.Add("to replace.", "REPLACED")
        HtmlFilter.SetHtmlFilter(Page, FilterReplaceValues, 10000)
        If Not IsPostBack Then
            Session("AJAXPostback") = 0
        End If
    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Session("AJAXPostback") += 1
        Me.Label1.Text = "AJAX Postback #"
        Dim FilterReplaceValues As New Specialized.NameValueCollection
        FilterReplaceValues.Add("AJAX Postback (?<number>#)", "AJAX Postback " & Session("AJAXPostback"))
        HtmlFilter.SetHtmlFilter(Page, FilterReplaceValues, 10000)
    End Sub
End Class
